<template>
  <div>
    <el-table :data="formattedList" style="width: 100%">
      <el-table-column prop="date" label="预约日期" width="180" />
      <el-table-column prop="name" label="预约人" width="180" />
      <el-table-column prop="phone" label="电话" />
      <el-table-column prop="set" label="套餐" />
      <el-table-column prop="massage" label="留言" />
    </el-table>
  </div>
</template>

<script>
import axios from 'axios';

export default {
  data() {
    return {
      list: [],
    };
  },
  computed: {
    formattedList() {
      return this.list.map(item => {
        const date = new Date(item.date);
        const formattedDate = date.toLocaleDateString(); // 这里可以自定义日期格式
        return { ...item, date: formattedDate };
      });
    },
  },
  created() {
    this.fetchData();
  },
  methods: {
    async fetchData() {
      try {
        const response = await axios.get('http://localhost:8081/Timetable/hello');
        this.list = response.data;
      } catch (error) {
        console.error('有问题', error);
      }
    },
  },
};
</script>

<style lang="less" scoped>
/* 可以添加你的样式 */
</style>